package com.itheima.controller;

import com.itheima.pojo.User;
import com.sun.org.apache.bcel.internal.generic.NEW;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

//设置当前类为Spring的控制器类
@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/login")
    public String login(User user, Model model){

        if(user.getUsername().equals("zhangsan")&&user.getPasswords().equals("123")){
            model.addAttribute("user",user);
            return "success";
        }
        return "redirect:/login.jsp";
    }
}
